import Cookies from 'js-cookie'
import {setCookie, getCookie} from "@/utils/support";

const TokenKey = 'loginToken'
const UserKey = 'username';
const PasswordKey = 'password';

export function getToken() {
  return getCookie(TokenKey);
}

export function setToken(token) {
  return setCookie(TokenKey, token, 15);
}

export function removeToken() {
  Cookies.remove(UserKey);
  Cookies.remove(PasswordKey);
  return Cookies.remove(TokenKey);
}

export function getUsername() {
  return getCookie(UserKey)
}

export function setUsername(username) {
  return setCookie(UserKey, username, 15)
}
